<!-- video grid -->

{if $config.video_display_type == 'preview'}
	{if $config.video_thumbnail_position == 'top'}
		<div class="thumb_horizontal">{include file='blocks'|cat:$smarty.const.RL_DS|cat:'video_thumbnails.tpl'}</div>
	{/if}
	<table class="listing_details">
	<tr>
		{if $config.video_thumbnail_position == 'left'}
		<td valign="top" class="side_bar_video">
			{include file='blocks'|cat:$smarty.const.RL_DS|cat:'video_thumbnails.tpl'}
		</td>
		{/if}
		<td valign="top" class="details">
			<div class="{if !$autoload}highlight {/if}highlight_loading">
				<a class="hide" href="{$smarty.const.RL_FILES_URL}{$videos.0.Video}" style="height:{$config.video_height}px;" id="player"></a>
				<div class="hide" id="video_youTube" style="height:{$config.video_height}px;"></div>
			</div>
		</td>
		{if $config.video_thumbnail_position == 'right'}
		<td valign="top" class="side_bar_video thumbnails_right">
			{include file='blocks'|cat:$smarty.const.RL_DS|cat:'video_thumbnails.tpl'}
		</td>
		{/if}
	</tr>
	</table>
	{if $config.video_thumbnail_position == 'bottom'}
		<div class="thumb_horizontal">{include file='blocks'|cat:$smarty.const.RL_DS|cat:'video_thumbnails.tpl'}</div>
	{/if}
{else}
	<div class="highlight">
	{if $videos|@count == 1}
		{if $videos.0.Type == 'local'}
			{include file='blocks'|cat:$smarty.const.RL_DS|cat:'video.tpl'}
		{elseif $videos.0.Type == 'youtube'}
			<script type="text/javascript">
			flynax.loadVideo('{$videos.0.Preview}', 'div#area_video div.highlight');
			</script>
		{/if}
	{else}
		{assign var='replace' value=`$smarty.ldelim`key`$smarty.rdelim`}
		<ul class="thumbnails inline">
		{foreach from=$videos item='video'}
			<li id="video_{$video.ID}">
				{if $video.Type == 'local'}
					<img src="{$smarty.const.RL_FILES_URL}{$video.Embed}" alt="" />
				{else}
					<img src="{$l_youtube_thumbnail|replace:$replace:$video.Preview}" alt="" />
				{/if}
			</li>
			
			<script type="text/javascript">
			{if $video.Type == 'local'}
			{literal}
			
			$('#video_{/literal}{$video.ID}{literal} img').click(function(){
				$.fancybox({
					padding			: 0,
					autoScale		: false,
					transitionIn	: 'none',
					transitionOut	: 'none',
					width			: {/literal}{$config.video_width}{literal},
					height			: {/literal}{$config.video_height}{literal},
					content			: '<a href="{/literal}{$smarty.const.RL_FILES_URL}{$video.Video}{literal}" style="display:block;width:{/literal}{$config.video_width}{literal}px;height:{/literal}{$config.video_height}{literal}px;" id="player"></a>',
					onComplete:		function(){
						flowplayer('player', {src: '{/literal}{$smarty.const.RL_LIBS_URL}{literal}player/flowplayer-3.2.7.swf', wmode: 'transparent'});
					},
					onClosed:		function(){
						$f().stop();
					}
				});
			});
			
			{/literal}
			{else}
			{literal}
			
			$('#video_{/literal}{$video.ID}{literal} img').click(function(){
				$.fancybox({
					padding			: 0,
					autoScale		: false,
					transitionIn	: 'none',
					transitionOut	: 'none',
					width			: {/literal}{$config.video_width}{literal},
					height			: {/literal}{$config.video_height}{literal},
					href			: '{/literal}{$l_youtube_direct|replace:$replace:$video.Preview}{literal}',
					type			: 'swf',
					swf				: {
						wmode		: 'transparent',
						allowfullscreen	: true
					}
				});
			});
			
			{/literal}
			{/if}
			</script>
		{/foreach}
		</ul>
		<div class="clear"></div>
	{/if}
</div>
{/if}

<!-- video grid end -->